package com.chaos.auth.config.userdetails.service.base;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;

import java.util.Map;

public interface UserDetailsExtService extends UserDetailsService {

    default UserDetails loadUserByUsername(String username, Long tenantId) throws OAuth2AuthenticationException {
        throw new UsernameNotFoundException("username not found");
    }

    default UserDetails loadUserByPhone(String phone, Long tenantId) throws OAuth2AuthenticationException {
        throw new OAuth2AuthenticationException("phone not found");
    }

    //根据三方开放平台 code，获取 openId
    default UserDetails loadUserByCode(String code, Map<String, Object> params) throws OAuth2AuthenticationException {
        throw new OAuth2AuthenticationException("openId not found");
    }


    default UserDetails loadUserByUsername(String username) throws OAuth2AuthenticationException {
        throw new OAuth2AuthenticationException("username not found");
    }

    default UserDetails loadUserByPhone(String phone) throws OAuth2AuthenticationException {
        throw new OAuth2AuthenticationException("phone not found");
    }


}